    //
//  MeetingMemberRecord.m
//  BVCMS
//
//  Created by Allen Thomas on 11/18/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "MeetingMemberRecord.h"


@implementation MeetingMemberRecord

@synthesize name;

@synthesize meetingId;

@synthesize peopleId;

@synthesize attended;

@synthesize attendIcon;

@synthesize member;

- (void) changeAttendance {
	if( [self.attended isEqualToString:@"True"] ) {
		self.attended = @"False";
	} else {
		self.attended = @"True";
	}
	NSLog(@"changed attendance to: %@", self.attended);
}

- (NSComparisonResult)compare:(MeetingMemberRecord *)p
{
	NSArray *selfWords = [self.name componentsSeparatedByString:@" "];
	NSArray *pWords = [p.name componentsSeparatedByString:@" "];
	NSString *selfLast = [selfWords objectAtIndex:([selfWords count]-1)];
	NSString *pLast = [pWords objectAtIndex:([pWords count]-1)];
	
	if( [self.member isEqualToString:@"True"] && [p.member isEqualToString:@"False"] ) {
		return NSOrderedAscending;
	} else if( [self.member isEqualToString:@"False"] && [p.member isEqualToString:@"True"] ) {
		return NSOrderedDescending;
	} 
	
	return [selfLast compare: pLast];
}

- (void)dealloc
{
    [name release];
	
    [meetingId release];
	
    [peopleId release];
	
    [attended release];
	
    [attendIcon release];
	
	[member release];
	
    [super dealloc];
}

@end
